import React, { Component, PropTypes } from 'react'
import { LineChart, AgreementEditPage, ChatRoomUser, ChatMessage, UserDetail } from './'
import { CustomerPage } from '../customer'
import { CoursePage } from '../course'
import { ClassPage } from '../class'
import { OrderPage,PayPage } from '../finance'
import { FeedbackPage, QuestionnairePage } from '../experience'
import { myFetch } from '../utils'

export default class BodyDynamicContent extends Component {
  constructor() {
    super()
    this.state = {
      types: [],
      sources: [],
      levels: [],
      managers: [],
    }
    this.fetchCommon = this.fetchCommon.bind(this)
  }
  componentDidMount() {
    this.fetchCommon()
  }
  render() {
    const { title, subtitle } = this.props
    const { types, sources, levels, managers } = this.state
    return (
      <div>
        {/*<CustomerPage />*/}
        {/*<CoursePage />*/}
        {/*<CustomerPage common={{types, sources, levels, managers}} />*/}
        {/*<OrderPage />*/}
        {/*<PayPage />*/}
        {/*<FeedbackPage />*/}
        <QuestionnairePage />
        {/*<ClassPage />*/}
      </div>
    )
  }
  fetchCommon() {
    myFetch('/v1/types')
      .then(rs => {
        if (rs) {
          this.setState({
            types: rs,
          })
        }
      })
    myFetch('/v1/levels')
      .then(rs => {
        if (rs) {
          this.setState({
            levels: rs,
          })
        }
      })
    myFetch('/v1/sources')
      .then(rs => {
        if (rs) {
          this.setState({
            sources: rs,
          })
        }
      })
    myFetch('/v1/managers')
      .then(rs => {
        if (rs) {
          this.setState({
            managers: rs,
          })
        }
      })
  }
}

BodyDynamicContent.propTypes = {
  title: PropTypes.string,
  subtitle: PropTypes.string,
}